/**
 * 员工档案数据持久化处理类
 * EmployeeDao.java
 * Copyright (C) 2013 Gank
 * Simple Currency Trade System
 * 
 */
package com.gank.ct.pm.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.gank.ct.common.BaseDao;
import com.gank.ct.pm.domain.User;
import com.gank.ct.util.ChkUtil;

/**
 * Copyright (C) 2013:Gank<br/>
 * Project:Curreny Trade<br/>
 * Module ID:<br/>
 * Comments:Simple Currency Trade System<br/>
 * JDK version used:JDK1.6<br/>
 * Package:com.gank.ct.dao<br/>
 * Author:Michael Wu<br/>
 * Create Date:2013-11-6<br/>
 * Modified By:<br/>
 * Modified Date:<br/>
 * Why & What is modified:<br/>
 * Version:0.1<br/>
 */
public class UserDao extends BaseDao<User, Integer> implements
		IUserDao {

	/*
	 * 员工档案查询
	 * 
	 * @see
	 * com.zds.slms.dao.IEmployeeDao#findEmployee(com.zds.slms.domain.User)
	 */
	public List<User> findUser(User user) {
		// 对象查询条件
		DetachedCriteria criteria = DetachedCriteria.forClass(User.class);
		if (null != user) {
			if (!ChkUtil.isNullOrEmpty(user.getUsercode())) {
				criteria.add(Restrictions.eq("usercode", user.getUsercode()));
			}
			if (!ChkUtil.isNullOrEmpty(user.getUserpwd())) {
				criteria.add(Restrictions.eq("userpwd", user.getUserpwd()));
			}
		}
		return findByCriteria(criteria);
	}


}
